From 0bd039a524c7839195e3282bdd27771fd1ad0df5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 29 May 2020 13:51:11 +0200 Subject: [PATCH] gtk-demo: Don't show main window if --run is passed in Also, in that case, exit when the demo window is closed. --- demos/gtk-demo/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index 9d802b8c1f..3ff4e22b91 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -1031,8 +1031,6 @@ activate (GApplication *app) gtk_tree_view_collapse_all (GTK_TREE_VIEW (treeview)); - gtk_widget_show (GTK_WIDGET (window)); - g_object_unref (builder); } @@ -1091,11 +1089,11 @@ command_line (GApplication *app, return 0; } + window = gtk_application_get_windows (GTK_APPLICATION (app))->data; + if (name == NULL) goto out; - window = gtk_application_get_windows (GTK_APPLICATION (app))->data; - d = gtk_demos; while (d->title) @@ -1125,7 +1123,11 @@ out: gtk_window_set_transient_for (GTK_WINDOW (demo), GTK_WINDOW (window)); gtk_window_set_modal (GTK_WINDOW (demo), TRUE); + + g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app); } + else + gtk_widget_show (GTK_WIDGET (window)); if (autoquit) g_timeout_add_seconds (1, auto_quit, app); -- 2.30.2